﻿@{
    ViewBag.Title = "Set_Button";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model IEnumerable<YJ.Data.Model.ProgramBuilderButtons>
<form method="post">
    <table class="listtable">
        <thead>
            <tr>
                <th width="3%" style="text-align:center;"><input type="checkbox" onclick="checkAll(this.checked);" style="vertical-align:middle;" /></th>
                <th>名称</th>
                <th>图标</th>
                <th>类型</th>
                <th>权限控制</th>
                <th>排序</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            @foreach(var button in Model)
            {    
           
            <tr>
                <td style="text-align:center;"><input type="checkbox" value="@button.ID" name="checkbox_app" style="vertical-align:middle;"/></td>
                <td>@Html.Raw(button.ButtonName)</td>
                <td>@Html.Raw(button.Ico.IsNullOrEmpty()?"": button.Ico.IsFontIco() ? "<i class='fa " + button.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;'></i>" : "<img src='"+Url.Content("~" + button.Ico)+"'/>")</td>
                <td>@(button.ShowType==0?"工具栏":button.ShowType==1?"普通按钮":"列表按钮")</td>
                <td>@(button.IsValidateShow==1?"是":"否")</td>
                <td>@button.Sort</td>
                <td>
                    <a class="editlink" href="javascript:;" onclick="add('@button.ID'); return false;">编辑</a>
                </td>
            </tr>
           
            }    
           
        </tbody>
    </table>
    <div class="buttondiv">
        <input type="button" class="mybutton" onclick="add('');" value="添加按钮" />
        <input type="submit" class="mybutton" onclick="return del();" value=" 删 除 " name="delete" />
    </div>
    </form>
    <script type="text/javascript">
        function checkAll(checked)
        {
            $("input[name='checkbox_app']").prop("checked", checked);
        }
        function add(id)
        {
            window.location = "Set_Button_Add?bid=" + (id || "") + "@Html.Raw(ViewBag.query)";
        }
        function del()
        {
            if ($(":checked[name='checkbox_app']").size() == 0)
            {
                alert("您没有选择要删除的按钮!");
                return false;
            }
            return confirm('您真的要删除所选按钮吗?');
        }
    </script>
